home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / batchut / what150.zip / WHAT.DOC < prev    next >
Text File  |  1990-09-24  |  18KB  |  359 lines

  1.                          WHAT - Batch file enhancer
  2.  
  3.                         Documentation and enhancements by
  4.                                   Tom Peters,
  5.                               Glendale, WI 53209
  6.  
  7.  
  8. Revision History:
  9.  
  10. October 1989  V1.3   Tom Peters   Many new functions
  11. January 1990  V1.4   Tom Peters   Extended P (printer) function to return
  12.                                   a character string. Also allowed checking
  13.                                   printer status for LPT1 thru LPT4.
  14. March 1990    V1.45  Tom Peters   Fix bug under DR-DOS that made K function
  15.                                   return 0 for directory, instead of 255.
  16.                                   Note: It is likely that other functions will
  17.                                   also exhibit anomalous behavior under DR-DOS.
  18.                                   Only the most rudimentary testing has been
  19.                                   done. If you find other bugs, please report
  20.                                   them to me. 
  21. April 3, 1990 V1.47  Tom Peters   Fix bug in T function that caused wrong
  22.                                   values from 12:00 to 12:59 in both AM & PM. 
  23. September 1990 V1.5  Tom Peters   Add G option- timed wait for character input.
  24.  
  25. WHAT    came   undocumented,  uncopyrighted,  and  unsupported,   with   my  
  26. assembler. After making extensive modifications, I have decided to make  it 
  27. available to the rest of the  computer community. WHAT has become an almost 
  28. indispensable  part  of my suite of DOS enhancement programs, and I'm  sure 
  29. that anyone  who has to write batch files will also come to find it so.
  30.  
  31. In   brief,  WHAT  allows you to ask questions during the  execution  of  a  
  32. batch  file  and take specific action based on the reply. But WHAT  is  NOT 
  33. limited  to  just  asking  the  user  for input via the keyboard.  It   can  
  34. also  ask  DOS questions,  like  "is  printer  2 online and ready?" or  "is  
  35. there  a  math coprocessor available?" or "how big is file XYZZY.ZIP?" etc. 
  36.  
  37. Command format:
  38. WHAT x[E] [parms][parms]
  39.  
  40. In  the  format above, "x" is a single option letter from the  list  below.  
  41. The   "E"   parameter,   if  given, alters the   operation   of   a   given  
  42. option  slightly,  e.g. WHAT C gets a character from the keyboard, WHAT  CE 
  43. does  the same with no echo of the character. 
  44.  
  45. Follow   the   command  WHAT  with one of the option letters,   as   below.  
  46. The  result  is  that the environment variable %WHAT% is created with   the  
  47. value  listed  under the "Environ" column below. Follow the  option  letter 
  48. with an  E for the result in the "Extended" column.
  49.  
  50. Do  NOT  enter  a space between the option letter and the  E  for  extended 
  51. functions,if used, IE WHAT SE is correct, WHAT S E is not. 
  52.  
  53. BUT,   DO  enter  a  space after the option letter and the  "E"   if   any,  
  54. to separate any arguments from the option letter and "E". 
  55.  
  56. This   is   best   seen  in the C option  (below)  when   used   with   the  
  57. optional prompt. Example:
  58.  
  59. WHAT CE "Install now? (Y or N)" YN
  60.  
  61. In  this  example,  the particular option is "C",  the  "get  a  character" 
  62. option,  the extended function is specified with the "E", a prompt is  used 
  63. (the  text in quotes) and only the "Y" and "N" keys are accepted. 
  64.  
  65. One  could  allow the user to enter "Y", "N", or ENTER by using  a  "~"  to 
  66. represent the ENTER e.g. WHAT CE "Install now? " YN~
  67.  
  68. WHAT   also   sets the DOS errorlevel to the value in the  "Exit"   column,  
  69. for most options. 
  70.  
  71. If  you  enter  some invalid data, like asking for the size of  a  file  (F 
  72. option) using a filename with wildcards, the number reported will be zero. 
  73.  
  74. Note:  Options  that have an option for Echo seem to be influenced  by  the 
  75. setting of the DOS batch switch ECHO, e.g. ECHO OFF.
  76.                            Brief options list:
  77.  
  78.                         WHAT V1.50- Batch file enhancer
  79.  
  80. Command                 Purpose    Argument   Environ     Exit    Extended
  81. ---------               -------    --------   -------     ----    --------
  82. C[E] ["prompt"] [chars] Get        Allowable  Character   Character   Echo
  83.                         character  characters
  84.  
  85. Accept   a   single char from keyboard. Returns tilde ("~")  if  ENTER   is  
  86. struck.  Echoes   the   char unless E used. Prompt in quotes  is  given  if  
  87. present.   If  an allowable  chars list is used, WHAT beeps and refuses  to 
  88. proceed until  one  of those chars is entered. Do not press ENTER after the 
  89. character entered. 
  90.  
  91. Options C and G do not allow extended keys, like arrow or function keys. 
  92.  
  93. Command                 Purpose     Argument   Environ     Exit        Extended
  94. ---------               -------     --------   -------     ----        --------
  95. G[E] ["prompt"] [chars] Get         Allowable  Character   Character   Echo
  96.                         character   characters
  97.  
  98. Accept   a   single char from keyboard. Returns tilde ("~")  if  ENTER   is  
  99. struck.  Echoes   the   char unless E used. Prompt in quotes  is  given  if  
  100. present.   If  an allowable  chars list is used, WHAT beeps and refuses  to 
  101. proceed until  one  of those chars is entered. Do not press ENTER after the 
  102. character entered. The G option differs from the C option in that it  gives 
  103. up after 65535 passes thru a loop if no key is ever struck. If this occurs, 
  104. WHAT return "TO" for "time out" to the environment. It should also return 0 
  105. to the DOS errorlevel but this is not tested. 
  106.  
  107. The  timed-wait is done by a crude loop and therefore will run for  various 
  108. amounts  of  time on various machines. It waited 20 seconds on  my  12  mHz 
  109. 80286, and roughly 65 seconds on an 9.54 mHz V20 (8088) machine. 
  110.  
  111. Command                 Purpose     Argument   Environ     Exit        Extended
  112. ---------               -------     --------   -------     ----        --------
  113. S[E] ["prompt"]         Get string  None       String      Length      Echo
  114.  
  115. Get a string from keyboard. Prompt is optional. Extended option  suppresses 
  116. echo. 
  117.  
  118. Command                 Purpose     Argument   Environ     Exit        Extended
  119. ---------               -------     --------   -------     ----        --------
  120. D[E]                    Check DOS   None       Major       (Major*10)  Minor
  121.                                                version     +Minor      version
  122.  
  123. Get  DOS  version running. WHAT D returns portion of DOS version  left   of  
  124. the decimal point. WHAT DE returns the other part. 
  125. Command                 Purpose     Argument   Environ     Exit        Extended
  126. ---------               -------     --------   -------     ----        --------
  127. E[E]                    Get environ None       Bytes       Bytes/10    10 bytes
  128.                         bytes left                         bytes       in exit
  129.  
  130. Get  number  of  bytes available in the environment,  or  number  of  bytes 
  131. divided by 10 (extended). 
  132.  
  133. Command                 Purpose     Argument   Environ     Exit        Extended
  134. ---------               -------     --------   -------     ----        --------
  135. F[E] filespec           Get file    Filespec   Kilobytes   Ks/10Ks     10Ks in
  136.                         size                     (255=directory)       exit
  137.  
  138. Get   size  of file "filespec" in kb. If Extended, get Kb/10. If  the  file  
  139. is   a  directory,  returns  255.  If file nonexistent or  exists  but   is  
  140. zero  length, returns 0.
  141.  
  142. Command                 Purpose     Argument   Environ     Exit        Extended
  143. ---------               -------     --------   -------     ----        --------
  144. K[E] [driveletter]      Get disk    Drive      Kilobytes   Ks/10Ks     10Ks in
  145.                         space                                          exit
  146.  
  147. Get  space  on  disk  in kbytes. Returns kbytes free,  or  tens  of  kbytes  
  148. if extended. If file nonexistent, returns 0.
  149.  
  150. Command                 Purpose     Argument   Environ     Exit        Extended
  151. ---------               -------     --------   -------     ----        --------
  152. M[E]                    Check       None       Kilobytes   Ks/10Ks     10Ks in
  153.